/**
 * Project Name:gc_sms_mvn
 * File Name:IAccountDaoImpl.java
 * Package Name:com.clps.dev.sms.dao.impl
 * Date:2018年11月15日下午5:37:49
 * Copyright (c) 2018, jackie.duan@clpsglobal.com All Rights Reserved.
 *
 */
package com.clps.dev.sms.dao.sm.impl;


import java.util.List;

import org.springframework.stereotype.Repository;
import com.clps.dev.sms.common.dao.impl.BaseDaoImpl;
import com.clps.dev.sms.dao.sm.AccountDao;
import com.clps.dev.sms.entity.sm.Account;

/**
 * 
 * ClassName: AccountDaoImpl 
 * @date 2018-11-28 14:25:19 
 *
 * @author jackie.duan
 * @version V1.0
 * @since JDK 1.8
 */
@Repository
public class AccountDaoImpl extends BaseDaoImpl<Account> implements AccountDao {

	private static final String HQL_QUERY_ACCOUNT_NAME = "from Account where accountName =:accountName";
	/**
	 * Creates a new instance of AccountDaoImpl.
	 *
	 * @param clazz
	 */
	
	public AccountDaoImpl() {
		
		super(Account.class);
		
	}

	/**
	 * 
	 * findByName
	 * @Description:通过name查询account
	 * @param accountName
	 * @return account
	 */
	@SuppressWarnings("unchecked")
	@Override
	public Account queryByName(String accountName) {
		
		List<Account> list =  (List<Account>) this.getHibernateTemplate().findByNamedParam(HQL_QUERY_ACCOUNT_NAME,"accountName", accountName);
		if(list.size() > 0) {
			Account account = null;
			for (Account account2 : list) {
				account = account2;
			}
			return account;
		}else {
			return null;
		}
		
	}
	

	
}
